<script setup lang="ts">
import { ref, onMounted } from "vue";

const todoList = ref<Todo[]>([]);
onMounted(() => {
  fetch("/api")
    .then((resp) => resp.json())
    .then((resp: JsonResp<Todo[]>) => {
      todoList.value = resp.data;
    });
});
</script>
<template>
  <ul>
    <li v-for="todo in todoList" :key="todo.id">{{ todo.title }}</li>
  </ul>
</template>
